<template>
    <div id="main">
        <div class="mod">
            {{msg}}

            <a href="#" class="btn">按钮</a>
            <a href="#" class="btn btn-danger">按钮</a>
            <a href="#" class="btn btn-disabled">按钮</a>

            <br>
            计时器：
            <div id="timer">
                {{timer}}
            </div>
        </div>
    </div>
</template>



<script>

    import utils from 'utils';
//    import $ from 'zepto';

    export default{
        data(){
            return{
                msg:'',
                timer:'00:00:00'
            }
        },
        beforeCreate: function () {
            utils.adaptive();
            var _self = this;

        },
        mounted: function () {
            var _self = this;


            //计时器
            var ms = 3600000;
            var int = setInterval(function(){

                var ss = 1000;
                var mi = ss * 60;
                var hh = mi * 60;
                var dd = hh * 24;

                var  day =         getTwoNum(ms / dd);
                var  hour =        getTwoNum((ms - day * dd) / hh);
                var  minute =      getTwoNum((ms - day * dd - hour * hh) / mi);
                var  second =      getTwoNum((ms - day * dd - hour * hh - minute * mi) / ss);
                var  milliSecond = getTwoNum(ms - day * dd - hour * hh - minute * mi - second * ss);

                _self.timer = hour+":"+minute+":"+second;
                ms -= 1000;
                if(ms<0){
                    clearInterval(int);
                }
            },1000);

            function getTwoNum(data){
                var int = parseInt(data);
                if(int<10)return "0"+int;
                else return int;
            }



            $.ajax({
                url:'',
                success: function(json){
                    console.log("改变数据-demo");
                    _self.msg='demo';
                },
                error(){
                    alert("加载失败..");
                }
            });

        },
        methods: {

        }
    }
</script>